# 合并字典
def merge_dict():
    first_dct = {"London": 1, "Paris": 2}
    second_dct = {"Tokyo": 3, "Seol": 4}
    merged = {**first_dct, **second_dct}
    print(merged)


# 遍历字典
def get_dict_key_value():
    cities = {'London': 1, 'Paris': 2, 'Tokyo': 3, 'Seol': 4}
    for key, value in cities.items():
        print(f"Key: {key} and Value: {value}")


# 更新字典
def update_dict():
    # 更新字典, 新增一个item
    my_dict = {1: "Python", 2: "JavaScript", 3: "Csharp"}
    my_dict.update({4: "Dart"})
    print(my_dict)  # {1: 'Python', 2: 'JavaScript', 3: 'Csharp', 4: 'Dart'}


if __name__ == '__main__':
    merge_dict()
    get_dict_key_value()
    update_dict()
